home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / AEalignCommon.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  10.0 KB  |  312 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //    Alias|Wavefront Script File
  19. //
  20. //    Creation Date:    May 29, 1997
  21. //    Author:            ajp
  22. //
  23. //    Procedure Name:
  24. //    AEalignCommon
  25. //
  26. //    Description Name;
  27. //    Creates the common attribute editor controls 
  28. //    for the alignCurve and align Surface Nodes
  29. //
  30. //    Input Value:
  31. //    nodeName
  32. //
  33. //    Output Value:
  34. //    None
  35. //
  36. /*
  37. global proc AEalignTangentCurvatureContinuityNew ( string $tangentContinuity, 
  38.                         string $curvatureContinuity )
  39. {
  40.     setUITemplate -pst attributeEditorTemplate;
  41.     radioButtonGrp -l ""
  42.             -l1 "Tangent Continuity"
  43.             -l2 "Curvature Continuity"
  44.             -nrb 2
  45.             tangentCurvatureContinuityRadioButton;
  46.     setUITemplate -ppt;
  47.  
  48.     AEalignTangentCurvatureContinuityReplace $tangentContinuity $curvatureContinuity;
  49. }
  50.  
  51.  
  52. global proc AEalignTangentCurvatureContinuityReplace ( string $tangentContinuity, 
  53.                         string $curvatureContinuity )
  54. {
  55.     string $nodeName[];
  56.     tokenize($tangentContinuity, ".", $nodeName);
  57.  
  58.     connectControl -in 1 tangentCurvatureContinuityRadioButton $tangentContinuity;
  59.     connectControl -in 2 tangentCurvatureContinuityRadioButton $curvatureContinuity;
  60.     radioButtonGrp -e
  61.             -cc1 ("tangentContinuityControls " + $nodeName[0] )
  62.             -cc2 ("curvatureContinuityControls " + $nodeName[0] )
  63.             -nrb 2
  64.             tangentCurvatureContinuityRadioButton;
  65. }
  66.  
  67. */
  68.  
  69. global proc AEalignPositionContinuityTypeNew( string $attrName )
  70. {
  71.     setUITemplate -pst attributeEditorTemplate;    
  72.      attrEnumOptionMenuGrp -attribute $attrName -l "Pos Continuity Type"
  73.         positionContiunityTypeEnum;
  74.     setUITemplate -ppt;
  75.  
  76.     AEalignPositionContinuityTypeReplace $attrName;
  77. }
  78.  
  79. global proc AEalignPositionContinuityTypeReplace( string $attrName )
  80. {
  81.     string $tmp[];
  82.     tokenize($attrName, ".", $tmp);
  83.     string $nodeName = $tmp[0];
  84.  
  85.      attrEnumOptionMenuGrp -e -attribute $attrName -l "Pos Continuity Type"
  86.         positionContiunityTypeEnum;
  87.  
  88.     scriptJob -p positionContiunityTypeEnum -rp
  89.         -ac $attrName ("positionalContinuityTypeControls " + $nodeName );
  90.  
  91.     evalDeferred ("positionalContinuityTypeControls " + $nodeName);
  92. }
  93.  
  94. global proc AEalignTangentContinuityTypeNew( string $attrName )
  95. {
  96.     setUITemplate -pst attributeEditorTemplate;    
  97.      attrEnumOptionMenuGrp -attribute $attrName -l "Tan Continuity Type"
  98.         tangentContiunityTypeEnum;
  99.     setUITemplate -ppt;
  100.  
  101.     AEalignTangentContinuityTypeReplace $attrName;
  102. }
  103.  
  104. global proc AEalignTangentContinuityTypeReplace( string $attrName )
  105. {
  106.     string $tmp[];
  107.     tokenize($attrName, ".", $tmp);
  108.     string $nodeName = $tmp[0];
  109.  
  110.      attrEnumOptionMenuGrp -e -attribute $attrName -l "Tan Continuity Type"
  111.         tangentContiunityTypeEnum;
  112.  
  113.     scriptJob -p tangentContiunityTypeEnum -rp
  114.         -ac $attrName ("interiorBlendingControls " + $nodeName );
  115.  
  116.     evalDeferred ("interiorBlendingControls " + $nodeName);
  117. }
  118.  
  119. global proc AEalignCommon ( string $nodeName, string $whichAlignNode )
  120. {
  121.     
  122.     editorTemplate -beginScrollLayout;
  123.         
  124.         editorTemplate -beginLayout "Align History" -collapse false;
  125.  
  126.             if ($whichAlignNode == "curve") {
  127.                 editorTemplate -callCustom "AEinputNew \"Input Curve 1\""
  128.                     "AEinputReplace \"Input Curve 1\""
  129.                     "inputCurve1";
  130.                 editorTemplate -callCustom "AEinputNew \"Input Curve 2\""
  131.                     "AEinputReplace \"Input Curve 2\""
  132.                     "inputCurve2";
  133.             } else {
  134.                 editorTemplate -callCustom "AEinputNew \"Input Surface 1\""
  135.                     "AEinputReplace \"Input Surface 1\""
  136.                     "inputSurface1";
  137.                 editorTemplate -callCustom "AEinputNew \"Input Surface 2\""
  138.                     "AEinputReplace \"Input Surface 2\""
  139.                     "inputSurface2";
  140.             }
  141.  
  142.             editorTemplate -addControl "positionalContinuity"
  143.                     "positionalContinuityControls";
  144.  
  145.             editorTemplate -callCustom "AEalignPositionContinuityTypeNew"
  146.                 "AEalignPositionContinuityTypeReplace" "positionalContinuityType";
  147.  
  148.             /*
  149.             editorTemplate -callCustom "AEalignTangentCurvatureContinuityNew"
  150.                         "AEalignTangentCurvatureContinuityReplace"
  151.                         "tangentContinuity" 
  152.                         "curvatureContinuity"; 
  153.             */
  154.  
  155.             editorTemplate -beginNoOptimize;
  156.             editorTemplate -addControl "tangentContinuity" 
  157.                         "tangentContinuityControls";
  158.             editorTemplate -addControl "curvatureContinuity" 
  159.                         "curvatureContinuityControls";
  160.             editorTemplate -endNoOptimize;
  161.  
  162.             editorTemplate -callCustom "AEalignTangentContinuityTypeNew"
  163.                 "AEalignTangentContinuityTypeReplace" "tangentContinuityType";
  164.  
  165.             if ($whichAlignNode == "surface")
  166.                 editorTemplate -addControl "directionU";
  167.  
  168.             editorTemplate -addControl "joinParameter";
  169.  
  170.             editorTemplate -addControl "reverse1";
  171.             editorTemplate -addControl "reverse2";
  172.             if ($whichAlignNode == "surface") {
  173.                 editorTemplate -addControl "swap1";
  174.                 editorTemplate -addControl "swap2";
  175.                 editorTemplate -addControl "twist";
  176.             }
  177.  
  178.             editorTemplate -beginLayout "Interior Blending First Object" -collapse false;
  179.                 editorTemplate -addControl "tangentScale1";
  180.                 editorTemplate -addControl "curvatureScale1";
  181.             editorTemplate -endLayout;
  182.  
  183.             editorTemplate -beginLayout "Interior Blending Second Object" -collapse false;
  184.                 editorTemplate -addControl "tangentScale2";
  185.                 editorTemplate -addControl "curvatureScale2";
  186.             editorTemplate -endLayout;
  187.             
  188.         editorTemplate -endLayout;
  189.         
  190.         // include/call base class/node attributes
  191.         AEabstractBaseCreateTemplate $nodeName;
  192.  
  193.     editorTemplate -suppress positionalContinuityType;
  194.     editorTemplate -suppress tangentContinuityType;
  195.  
  196.     editorTemplate -addExtraControls;
  197.  
  198.     editorTemplate -endScrollLayout;
  199.  
  200. }
  201.  
  202. global proc positionalContinuityControls( string $nodeName )
  203. {
  204.     string    $posAttrName = $nodeName + ".positionalContinuity";
  205.     string    $tanAttrName = $nodeName + ".tangentContinuity";
  206.     string    $crvAttrName = $nodeName + ".curvatureContinuity";
  207.     int    $posAttrValue = `getAttr $posAttrName`;
  208.  
  209.     if ($posAttrValue == 0) {
  210.         // must have at least position alignment
  211.         //setAttr $posAttrName 1;
  212.         //setAttr $tanAttrName 0;
  213.         //setAttr $crvAttrName 0;
  214.         editorTemplate -dimControl $nodeName "positionalContinuityType" true;
  215.     } else {
  216.         editorTemplate -dimControl $nodeName "positionalContinuityType" false;
  217.     }
  218.     interiorBlendingControls($nodeName);
  219. }
  220.  
  221. global proc positionalContinuityTypeControls( string $nodeName )
  222. {
  223.     string    $posTypeAttrName = $nodeName + ".positionalContinuityType";
  224.     int    $posAttrTypeValue = `getAttr $posTypeAttrName`;
  225.  
  226.     if ( $posAttrTypeValue == 3 || $posAttrTypeValue == 6 )
  227.     {
  228.         // can't change join parameter when "both" positional type
  229.         editorTemplate -dimControl $nodeName "joinParameter" true;
  230.     }
  231.     else
  232.     {
  233.         editorTemplate -dimControl $nodeName "joinParameter" false;
  234.     }
  235. }
  236.  
  237. global proc tangentContinuityControls( string $nodeName )
  238. {
  239.     string    $posAttrName = $nodeName + ".positionalContinuity";
  240.     string    $tanAttrName = $nodeName + ".tangentContinuity";
  241.     string    $crvAttrName = $nodeName + ".curvatureContinuity";
  242.     int    $tanAttrValue = `getAttr $tanAttrName`;
  243.     int     $posAttrValue = `getAttr $posAttrName`;
  244.     int     $crvAttrValue = `getAttr $crvAttrName`;
  245.  
  246.     // want to disable curvature alignment regardless
  247.     //if ($crvAttrValue == 1)
  248.     //    setAttr $crvAttrName 0;
  249.     editorTemplate -dimControl $nodeName "curvatureScale1" true;
  250.     editorTemplate -dimControl $nodeName "curvatureScale2" true;
  251.  
  252.     if ($tanAttrValue == 1) {
  253.         //if ($posAttrValue == 0 )
  254.         //    setAttr $posAttrName 1;
  255.         editorTemplate -dimControl $nodeName "tangentContinuityType" false;
  256.     } else {
  257.         setAttr $crvAttrName 0;
  258.         editorTemplate -dimControl $nodeName "tangentContinuityType" true;
  259.     }
  260.     interiorBlendingControls($nodeName);
  261. }
  262.  
  263. global proc curvatureContinuityControls( string $nodeName )
  264. {
  265.     string    $posAttrName = $nodeName + ".positionalContinuity";
  266.     string    $tanAttrName = $nodeName + ".tangentContinuity";
  267.     string    $crvAttrName = $nodeName + ".curvatureContinuity";
  268.     int    $crvAttrValue = `getAttr $crvAttrName`;
  269.     int     $tanAttrValue = `getAttr $tanAttrName`;
  270.     int     $posAttrValue = `getAttr $posAttrName`;
  271.  
  272.     if ($crvAttrValue == 1) {
  273.         //if ($posAttrValue == 0)
  274.         //    setAttr $posAttrName 1;
  275.         if ($tanAttrValue == 0){
  276.             setAttr $tanAttrName 1;
  277.             setAttr $crvAttrName 1;
  278.         }
  279.         editorTemplate -dimControl $nodeName "tangentContinuityType" false;
  280.     }
  281.     interiorBlendingControls($nodeName);
  282. }
  283.  
  284. global proc interiorBlendingControls( string $nodeName )
  285. {
  286.     string    $crvAttrName = $nodeName + ".curvatureContinuity";
  287.     string    $tanAttrName = $nodeName + ".tangentContinuity";
  288.     string    $tanTypeAttrName = $nodeName + ".tangentContinuityType";
  289.  
  290.     int    $crvValue = `getAttr $crvAttrName`;
  291.     int    $tanValue = `getAttr $tanAttrName`;
  292.     int    $tanTypeValue = `getAttr $tanTypeAttrName`;
  293.  
  294.     if ($tanValue == 0) {
  295.         editorTemplate -dimControl $nodeName "tangentScale1" true;
  296.         editorTemplate -dimControl $nodeName "curvatureScale1" true;
  297.         editorTemplate -dimControl $nodeName "tangentScale2" true;
  298.         editorTemplate -dimControl $nodeName "curvatureScale2" true;
  299.         editorTemplate -dimControl $nodeName "tangentContinuityType" true;
  300.     } else {
  301.         editorTemplate -dimControl $nodeName "tangentScale1" false;
  302.         editorTemplate -dimControl $nodeName "tangentScale2" false;
  303.         if ($crvValue == 1) {
  304.             editorTemplate -dimControl $nodeName "curvatureScale1" false;
  305.             editorTemplate -dimControl $nodeName "curvatureScale2" false;
  306.         } else {
  307.             editorTemplate -dimControl $nodeName "curvatureScale1" true;
  308.             editorTemplate -dimControl $nodeName "curvatureScale2" true;
  309.         }
  310.     }
  311. }
  312.